import Instance from '@/utils/http.ts';

export function useGetEquipmentTypeAPI(current:number,pageSize:number){
    return Instance({
        url:'/equip-type/getAll',
        method:'GET',
        params: {current: current, pageSize: pageSize}
    })
}

export function useGetEquipTypeCountAPI(){
    return Instance({
        url:'/equip-type/getAllCount',
        method:'GET'
    })
}

export function useGetEquipTypeByPageAPI(current:number,pageSize:number){
    return Instance({
        url:'/equip-type/getAllByPage',
        method:'GET',
        params: {current: current, pageSize: pageSize}
    })
}

export function useDeleteEquipTypeAPI(id:number){
    return Instance({
        url:`/equip-type/${id}`,
        method:'DELETE'
    })
}

interface EquipType {
    id: number;
    parentType: string;
    childType: string;
    description: string;
}

export function useUpdateEquipTypeAPI(equipType:EquipType){
    return Instance({
        url:'/equip-type/modifyOne',
        method:'PUT',
        data: equipType
    })
}
export function useAddEquipTypeAPI(equipType:EquipType){
    return Instance({
        url:'/equip-type/saveOne',
        method:'POST',
        data: equipType
    })
}

export function useGetEquipTypeByIdAPI(id:number){
    return Instance({
        url:`/equip-type/${id}`,
        method:'GET'
    })
}